<template>
  <div>

  </div>
</template>

<script lang="ts">
import { defineComponent, inject, onMounted } from 'vue'

export default defineComponent({
  setup() {
    const msg: string = inject('msg') || '';
    const userInfo = inject('userInfo')//响应类型-接收
    const tags: string[] = inject('tags') || []; //引用类型-接收
    const tagsCount: number = inject('tagsCount') || 0;//基础类型-接收
    const tagsCount1: any = inject('tagsCount1') || 0;//
    const name: any = inject('name') || '';

    console.log("name=1", name());
    console.log("userInfo=1", userInfo);
    console.log("tags=1", tags);
    console.log("tagsCount=1,:", tagsCount);
    console.log("tagsCount1=1", tagsCount1());


    onMounted(() => {
      console.log("msg-孙子", msg);


      setTimeout(() => {
        console.log("name=3000", name());

        console.log("userInfo=3000", userInfo);

        console.log("tags==3000", tags);

        console.log("tagsCount=3000:", tagsCount);//依然是3

        console.log("tagsCount1=3000:", tagsCount1());

      }, 3000)

    })

    return {}
  }
})
</script>

<style scoped>

</style>
